<?php if(count($this->comments) > 0):?>
    <?php foreach($this->comments as $comment):?>
    <li id="comment_content_<?php echo $comment->id;?>">
        <div style="float:left; width:45px;">
            <?php

                /**
                * User of commment to view
                **/
                $cUI = isset($this->arrUserCInfo[$comment->id])?$this->arrUserCInfo[$comment->id]:null;
			
                if(isset($cUI['enterprise']->id)){
                /**
                * Check image exist directory
                **/
                $file = $this->APP_STATIC_SERVER.'/images/logos/'.$cUI['enterprise']->id.'.jpg';
                $path = str_replace($this->APP_STATIC_SERVER,getcwd(),$file);
                if(!is_file($path)){
                    $file = $this->APP_STATIC_SERVER.'/images/logos/no-logo.jpg';
                }
                
                /**
				* Enterprise route
				*/
				$arrRouteEn = array(
					'enterprise_id' => $cUI['enterprise']->id,					                    
					'enterprise_name' => Tomato_Utility_String::removeSign($cUI['enterprise']->company_name_vn, '-', true),                    
				);
            ?>
            <a href="<?php echo $this->url($arrRouteEn, 'bizprofile_enterprise_index');?>"><img width="40" src="<?php echo $file;?>" /></a>
            <?php }else{?>
				<img width="40" src="<?php echo $this->APP_STATIC_SERVER.'/images/logos/no-logo.jpg';?>" />
			<?php }?>
        </div>
        <div align="left" style="float:left; width:475px; font-size:11px;">
            <?php if(isset($cUI['enterprise']->id)){?>	
        		<a href="<?php echo $this->url($arrRouteEn, 'bizprofile_enterprise_index');?>">
	            	<?php echo ($cUI['user']->full_name)?$cUI['user']->full_name:$cUI['user']->user_name;?>
	            	<?php echo ($cUI['enterprise'])?', '.$cUI['enterprise']->company_name_vn:null;?>
            	</a>
            <?php }else{?>
				<?php echo ($cUI['user']->full_name)?$cUI['user']->full_name:$cUI['user']->user_name;?>
			<?php }?>
            <br/>
            <?php echo $comment->content;?>
            <br/>
            <label style="font-size:10px; color:#555555;"><?php echo date('h:i:s d/m/Y', strtotime($comment->date));?></label>
        </div>
        <?php if(@$this->user->enterprise->id == $this->enterprise_id):?>
        <div style="float:left; width:10px; margin-top:-5px; padding-left:5px;">
            <a href="javascript:void(0)" class="del_comment" rel="<?php echo $comment->id;?>">
                <b>x</b>
            </a>
        </div>
        <?php endif;?>
    </li>
    <?php endforeach;?>
<?php endif;?>
<script type="text/javascript">
    $(document).ready(function() {
        /**
        * Delete comment
        */
        $('a.del_comment').click(function() {
        var self = this;
        $('#confirmDialog').html('<?php echo addslashes($this->translator('blog_view_action_delete_comment_confirm')); ?>')
            .dialog({
                title: '<?php echo addslashes($this->translator('common_dialog_confirm')); ?>',
                dialogClass: 't_a_ui_dialog',
                modal: true,
                closeOnEscape: false,
                resizable: false,
                open: function(event, ui) {
                    $('.ui-dialog-titlebar-close').hide();
                    $(this).parent().find('.ui-dialog-buttonpane button').wrapInner('<span/>');
                },
                buttons: {
                    '<?php echo addslashes($this->translator('common_dialog_confirm_no')); ?>': function() {
                        $(this).dialog('destroy');
                    },
                    '<?php echo addslashes($this->translator('common_dialog_confirm_yes')); ?>': function() {
                        $(this).dialog('destroy');
                        /*$(self).html('').addClass('t_a_ui_helper_loading');*/
                        var id = $(self).attr('rel');
                        $.ajaxq('comment', {
                            type: 'POST',
                            url: "<?php echo $this->url(array(), 'b2b_blog_comment_delete'); ?>",
                            data: { id: id },
                            success: function(response) {
                                if ('RESULT_OK' == response) {
                                    $('#comment_content_' + id).fadeOut('slow');
                                }
                            }
                        });
                    }
                }
            });
        });/** end delete*/
    });
</script>